package com.chw.shop.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.chw.shop.dao.TypeDao;
import com.chw.shop.entity.po.Type;
import com.chw.shop.service.TypeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class TypeServiceImpl implements TypeService {
    @Autowired
    private TypeDao typeDao;


    @Override
    public Object queryZj(Integer id) {

        QueryWrapper queryWrapper=new QueryWrapper();
        queryWrapper.eq("pid",id);
        return "";

    }

   /* private void getChildren(Integer id) {
        QueryWrapper qw=new QueryWrapper();
        qw.eq("pid",id);
        List<Type> list1 = typeDao.selectList(qw);
       Integer count=0;
        sb.append(",\"children\":[");
        for (int i = 0; i < list1.size(); i++) {
            count++;
            Type type=  list1.get(i);
            sb.append("{");
            sb.append("\"id\":\"").append(type.getId()).append("\",\"name\":\"")
                    .append(type.getName()).append("\",\"pid\":\"").append(type.getPid()).append("\"},");
        }
        if (count>0){
            sb.append(sb.replace(sb.length()-1,sb.length(),"]"));
        }else {
            sb.append(sb.replace(sb.length()-13,sb.length(),"]"));
        }

    }*/
}
